/**
 * OIDC认证配置接口
 */
export interface AuthConfig {
  /** 客户端ID */
  clientId: string;
  /** 认证服务器地址 */
  authority: string;
  /** 回调地址 */
  redirectUri: string;
  /** 授权范围 */
  scopes: string;
}

/**
 * OIDC用户信息接口
 */
export interface OidcUserInfo {
  /** 用户Id */
  sub: string;
  /** 用户名 */
  name: string;
  /** 用户昵称 */
  nickname?: string;
  /** 头像 */
  picture?: string;
  /** 邮箱 */
  email?: string;
  /** 邮箱已验证 */
  email_verified?: boolean;
  /** 手机号 */
  phone_number?: string;
  /** 手机号已验证 */
  phone_number_verified?: boolean;
  /** 角色 */
  role?: string[];
}

export interface IInDto {
  id?: string;
}

export interface IOutDto {
  id?: string;
}

export interface ApiResult {
  data?: { [key: string]: any } | null;
  message?: null | string;
  resultType?: ApiResultType;
}

/**
 * 表示Api操作结果类型的枚举
 */
export enum ApiResultType {
  Success = 200,
  Info = 203,
  UnAuth = 401,
  Forbidden = 403,
  NotFound = 404,
  Locked = 423,
  Error = 500,
}

export interface PageResult<T = any> {
  data: T[];
  total: number;
}

/**
 * 表示过滤规则的接口
 */
export interface FilterRule {
  field: string;
  isLowerCaseToUpperCase?: boolean;
  operate?: FilterOperate;
  value?: null | string;
}
/**
 * FilterGroup
 */
export interface FilterGroup {
  groups: FilterGroup[];
  operate: FilterOperate;
  rules: FilterRule[];
}

/**
 * 表示过滤操作类型的枚举
 */
export enum FilterOperate {
  And = 1,
  Or = 2,
  Equal = 3,
  NotEqual = 4,
  Less = 5,
  LessOrEqual = 6,
  Greater = 7,
  GreaterOrEqual = 8,
  StartsWith = 9,
  EndsWith = 10,
  Contains = 11,
  NotContains = 12,
}

export enum ListSortDirection {
  Ascending = 0,
  Descending = 1,
}

/**
 * 排序条件接口
 */
export interface SortCondition {
  sortField: string;
  listSortDirection: ListSortDirection;
}

/**
 * 分页条件接口
 */
export interface PageCondition {
  pageIndex: number;
  pageSize: number;
  sortConditions: SortCondition[];
}

/**
 * 分页数据请求接口
 */
export interface PageQuery {
  pageCondition: PageCondition;
  filterGroup: FilterGroup;
}

/**
 * 服务信息接口
 */
export interface ServiceInfo {
  key: string;
  name: string;
}

export interface EntityInfo {
  code: string;
  display: string;
}
